/*
 * Class31 - Decompiled by JODE
 * Visit http://jode.sourceforge.net/
 */
public final class Class31 {
	private static int anInt587 = 20411;
	public static char[] aCharArray588 = new char[100];
	private static Packet aPacket_589 = new Packet(new byte[100]);
	private static char[] aCharArray590 = { ' ', 'e', 't', 'a', 'o', 'i', 'h', 'n', 's', 'r', 'd',
		'l', 'u', 'm', 'w', 'c', 'y', 'f', 'g', 'p', 'b', 'v', 'k', 'x', 'j', 'q', 'z', '0', '1',
		'2', '3', '4', '5', '6', '7', '8', '9', ' ', '!', '?', '.', ',', ':', ';', '(', ')', '-',
		'&', '*', '\\', '\'', '@', '#', '+', '=', '\u00a3', '$', '%', '\"', '[', ']' };

	public static String method320(int i, Packet packet, int i_0_) {
		int i_1_ = 0;
		int i_2_ = -1;
		for (int i_3_ = 0; i_3_ < i_0_; i_3_++) {
			int i_4_ = packet.getUByte();
			int i_5_ = i_4_ >> 4 & 0xf;
			if (i_2_ == -1) {
				if (i_5_ < 13) {
					Class31.aCharArray588[i_1_++] = Class31.aCharArray590[i_5_];
				} else {
					i_2_ = i_5_;
				}
			} else {
				Class31.aCharArray588[i_1_++] = Class31.aCharArray590[(i_2_ << 4) + i_5_ - 195];
				i_2_ = -1;
			}
			i_5_ = i_4_ & 0xf;
			if (i_2_ == -1) {
				if (i_5_ < 13) {
					Class31.aCharArray588[i_1_++] = Class31.aCharArray590[i_5_];
				} else {
					i_2_ = i_5_;
				}
			} else {
				Class31.aCharArray588[i_1_++] = Class31.aCharArray590[(i_2_ << 4) + i_5_ - 195];
				i_2_ = -1;
			}
		}
		boolean bool = true;
		for (int i_6_ = 0; i_6_ < i_1_; i_6_++) {
			char c = Class31.aCharArray588[i_6_];
			if (bool && c >= 'a' && c <= 'z') {
				Class31.aCharArray588[i_6_] += -32;
				bool = false;
			}
			if (c == '.' || c == '!' || c == '?') {
				bool = true;
			}
		}
		if (i != 0) {
			Class31.anInt587 = -409;
		}
		return new String(Class31.aCharArray588, 0, i_1_);
	}

	public static void method321(String string, int i, Packet packet) {
		if (string.length() > 80) {
			string = string.substring(0, 80);
		}
		string = string.toLowerCase();
		if (i <= 0) {
			for (int i_7_ = 1; i_7_ > 0; i_7_++) {
				/* empty */
			}
		}
		int i_8_ = -1;
		for (int i_9_ = 0; i_9_ < string.length(); i_9_++) {
			char c = string.charAt(i_9_);
			int i_10_ = 0;
			for (int i_11_ = 0; i_11_ < Class31.aCharArray590.length; i_11_++) {
				if (c == Class31.aCharArray590[i_11_]) {
					i_10_ = i_11_;
					break;
				}
			}
			if (i_10_ > 12) {
				i_10_ += 195;
			}
			if (i_8_ == -1) {
				if (i_10_ < 13) {
					i_8_ = i_10_;
				} else {
					packet.putByte(i_10_);
				}
			} else if (i_10_ < 13) {
				packet.putByte((i_8_ << 4) + i_10_);
				i_8_ = -1;
			} else {
				packet.putByte((i_8_ << 4) + (i_10_ >> 4));
				i_8_ = i_10_ & 0xf;
			}
		}
		if (i_8_ != -1) {
			packet.putByte(i_8_ << 4);
		}
	}

	public static String method322(byte i, String string) {
		Class31.aPacket_589.offset = 0;
		Class31.method321(string, 569, Class31.aPacket_589);
		int i_12_ = Class31.aPacket_589.offset;
		if (i != 0) {
			for (int i_13_ = 1; i_13_ > 0; i_13_++) {
				/* empty */
			}
		}
		Class31.aPacket_589.offset = 0;
		String string_14_ = Class31.method320(0, Class31.aPacket_589, i_12_);
		return string_14_;
	}
}
